﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <Style x:Key="Style.DecreaseRepeatButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Background" Value="{DynamicResource Brush.Slider.DecreaseButton.Background}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.Slider.DecreaseButton.Border}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Height="{TemplateBinding Height}"
                        Width="{TemplateBinding Width}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Style.IncreaseRepeatButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Background" Value="{DynamicResource Brush.Slider.IncreaseButton.Background}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.Slider.IncreaseButton.Border}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Style.Slider.Thumb" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Background" Value="{DynamicResource Brush.Slider.Thumb.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.Slider.Thumb.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Height" Value="12"/>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Width" Value="12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border 
                        CornerRadius="999" 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        ClipToBounds="True" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Style.Slider" TargetType="{x:Type Slider}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Slider}">
                    <Track 
                        x:Name="PART_Track" 
                        Grid.Row="1" 
                        Height="{TemplateBinding Height}" 
                        HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                        VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                        Width="{TemplateBinding Width}">
                        <Track.DecreaseRepeatButton>
                            <RepeatButton 
                                x:Name="PART_DecreaseRepeatButton" 
                                Command="Slider.DecreaseLarge"
                                Style="{StaticResource Style.DecreaseRepeatButton}" />
                        </Track.DecreaseRepeatButton>
                        <Track.Thumb>
                            <Thumb Style="{StaticResource Style.Slider.Thumb}" />
                        </Track.Thumb>
                        <Track.IncreaseRepeatButton>
                            <RepeatButton 
                                x:Name="PART_IncreaseRepeatButton"  
                                Command="Slider.IncreaseLarge"
                                Style="{StaticResource Style.IncreaseRepeatButton}"/>
                        </Track.IncreaseRepeatButton>
                    </Track>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter TargetName="PART_DecreaseRepeatButton" Property="Width" Value="2" />
                            <Setter TargetName="PART_IncreaseRepeatButton" Property="Width" Value="2" />
                        </Trigger>
                        <Trigger Property="Orientation" Value="Horizontal">
                            <Setter TargetName="PART_DecreaseRepeatButton" Property="Height" Value="2" />
                            <Setter TargetName="PART_IncreaseRepeatButton" Property="Height" Value="2" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="MinHeight" Value="100" />
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="HorizontalAlignment" Value="Center" />
            </Trigger>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="MinWidth" Value="100" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="{DynamicResource DisabledOpacity}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type Slider}" BasedOn="{StaticResource Style.Slider}"/>
</ResourceDictionary>